﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UlsStudio.AppCore;

namespace UlsStudio.DesktopApp
{
    internal partial class SearchInGridForm : Form
    {
        public SearchInGridForm()
        {
            this.Settings = new GridSearchSettings();
            InitializeComponent();
        }

        public GridSearchSettings Settings { get; set; }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.Owner is MainForm)
            {
                MainForm f = (MainForm)this.Owner;
                f.SearchInGrid( new GridSearchSettings(txtSearch.Text, chkDown.Checked));
                this.Close();
            }
        }

        private void SearchInGridForm_Load(object sender, EventArgs e)
        {
            txtSearch.Text = this.Settings.SearchText;
            if (this.Settings.SearchDown)
            {
                chkDown.Checked = true;
            }
            else
            {
                chkUp.Checked = true;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
